home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / pdriver5.arc / GENERIC.ASM < prev    next >
Assembly Source File  |  1989-12-17  |  3KB  |  138 lines

  1. version    equ    0
  2.  
  3.     include    defs.asm
  4.  
  5. code    segment    byte public
  6.     assume    cs:code, ds:code
  7.  
  8.     public    int_no
  9. int_no    db    0,0,0,0            ;must be four bytes long for get_number.
  10.  
  11.     public    driver_class, driver_type, driver_name
  12. driver_class    db    0        ;from the packet spec
  13. driver_type    db    0        ;from the packet spec
  14. driver_name    db    'generic',0    ;name of the driver.
  15.  
  16.     public    rcv_modes
  17. rcv_modes    dw    4        ;number of receive modes in our table.
  18.         dw    0,0,0,rcv_mode_3
  19.  
  20.     public    send_pkt
  21. send_pkt:
  22. ;enter with ds:si -> packet, cx = packet length.
  23. ;exit with nc if ok, or else cy if error, dh set to error number.
  24.     assume    ds:nothing
  25.     ret
  26.  
  27.  
  28.     public    get_address
  29. get_address:
  30. ;get the address of the interface.
  31. ;enter with es:di -> place to get the address, cx = size of address buffer.
  32. ;exit with nc, cx = actual size of address, or cy if buffer not big enough.
  33.     assume    ds:code
  34.     ret
  35.  
  36.  
  37.     public    set_address
  38. set_address:
  39. ;enter with ds:si -> Ethernet address, CX = length of address.
  40. ;exit with nc if okay, or cy, dh=error if any errors.
  41.     assume    ds:nothing
  42.     ret
  43.  
  44.  
  45. rcv_mode_3:
  46. ;receive mode 3 is the only one we support, so we don't have to do anything.
  47.     ret
  48.  
  49.  
  50.     public    set_multicast_list
  51. set_multicast_list:
  52. ;enter with es:di ->list of multicast addresses, cx = number of bytes.
  53. ;return nc if we set all of them, or cy,dh=error if we didn't.
  54.     mov    dh,NO_MULTICAST
  55.     stc
  56.     ret
  57.  
  58.  
  59.     public    get_multicast_list
  60. get_multicast_list:
  61. ;return with nc, es:di ->list of multicast addresses, cx = number of bytes.
  62. ;return cy, NO_ERROR if we don't remember all of the addresses ourselves.
  63. ;return cy, NO_MULTICAST if we don't implement multicast.
  64.     mov    dh,NO_MULTICAST
  65.     stc
  66.     ret
  67.  
  68.  
  69.     public    reset_interface
  70. reset_interface:
  71. ;reset the interface.
  72.     assume    ds:code
  73.     ret
  74.  
  75.  
  76. ;called when we want to determine what to do with a received packet.
  77. ;enter with cx = packet length, es:di -> packet type.
  78.     extrn    recv_find: near
  79.  
  80. ;called after we have copied the packet into the buffer.
  81. ;enter with ds:si ->the packet, cx = length of the packet.
  82.     extrn    recv_copy: near
  83.  
  84.     extrn    count_in_err: near
  85.     extrn    count_out_err: near
  86.  
  87.     public    recv
  88. recv:
  89. ;called from the recv isr.  All registers have been saved, and ds=cs.
  90. ;Upon exit, the interrupt will be acknowledged.
  91.     assume    ds:code
  92.     ret
  93.  
  94.  
  95.     public    recv_exiting
  96. recv_exiting:
  97. ;called from the recv isr after interrupts have been acknowledged.
  98. ;Only ds and ax have been saved.
  99.     assume    ds:nothing
  100.     ret
  101.  
  102.  
  103. ;any code after this will not be kept after initialization.
  104. end_resident    label    byte
  105.  
  106.  
  107.     public    usage_msg
  108. usage_msg    db    "usage: generic <packet_int_no>",CR,LF,'$'
  109.  
  110.     public    copyright_msg
  111. copyright_msg    db    "Packet driver for a generic device, version ",'0'+version,CR,LF,'$'
  112.         db    "Portions Copyright 19xx, J. Random Hacker",CR,LF,'$'
  113.  
  114.     extrn    set_recv_isr: near
  115.  
  116. ;enter with si -> argument string, di -> wword to store.
  117. ;if there is no number, don't change the number.
  118.     extrn    get_number: near
  119.  
  120.     public    parse_args
  121. parse_args:
  122.     ret
  123.  
  124.  
  125.     public    etopen
  126. etopen:
  127. ;if all is okay,
  128.     mov    dx,offset end_resident
  129.     clc
  130.     ret
  131. ;if we got an error,
  132.     stc
  133.     ret
  134.  
  135. code    ends
  136.  
  137.     end
  138.